import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// 全局常量
import common from '@/utils/common'
Vue.prototype.global = common

// 全局方法挂载
import { filterValue, inputPInYinCode, filterKeyVal } from '@/utils/common'
Vue.prototype.filterValue = filterValue
Vue.prototype.inputPInYinCode = inputPInYinCode
Vue.prototype.filterKeyVal = filterKeyVal

// 全局组件挂载
import Pagination from '@/components/Pagination' // 页码
Vue.component('Pagination', Pagination)

// el-radio-group 组件报错,全局优化，使用v-removeAriaHidden
Vue.directive('removeAriaHidden', {
  bind(el, binding) {
    const ariaEls = el.querySelectorAll('.el-radio__original')
    ariaEls.forEach((item) => {
      item.removeAttribute('aria-hidden')
    })
  }
})

Vue.use(ElementUI)
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
